package com.springboot.tiki.minio;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName config
 * @Description: minio配置类
 * @author: kuaiqing
 * @CreateDate: 2025/10/22 13:58
 * @Version: 1.0
 */

@Configuration
public class MinioConfig {

    @Value("${minio.endpoint:}")
    private String endpoint;
    @Value("${minio.access-key:}")
    private String accessKey;
    @Value("${minio.secret-key:}")
    private String secretKey;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                // 设置服务运行的地址
                .endpoint(endpoint)
                // 设置账号名和密码
                .credentials(accessKey, secretKey)
                .build();
    }

    public String getEndpoint() {
        return endpoint;
    }
}


